package cn.iocoder.yudao.hires.controller.admin.notice.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.hires.entity.NoticeEnterpriseDO;
import cn.iocoder.yudao.hires.service.notice.NoticeEnterpriseService;
import cn.iocoder.yudao.hires.vo.noticeenterprise.NoticeEnterpriseSaveReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "APP - 下游-企业人才库")
@RestController
@RequestMapping("/app/notice-enterprise")
@Validated
public class AppNoticeEnterpriseController {

    @Resource
    private NoticeEnterpriseService noticeEnterpriseService;


    @GetMapping("/list")
    @Operation(summary = "企业人才库")
    @TenantIgnore
    //@PreAuthorize("@ss.hasPermission('system:notice-enterprise:query')")
    public CommonResult<List<NoticeEnterpriseDO>> getNoticeEnterpriseList(Integer positionId, String positionName, Long tenantId) {
        return success(noticeEnterpriseService.getNoticeEnterpriseList(positionId, positionName, tenantId));
    }


    @PostMapping("/create")
    @Operation(summary = "企业添加人才库")
    //@PreAuthorize("@ss.hasPermission('system:notice-enterprise:create')")
    public CommonResult<Long> createNoticeEnterprise(@Valid @RequestBody NoticeEnterpriseSaveReqVO createReqVO) {
        return success(noticeEnterpriseService.createNoticeEnterprise(createReqVO));
    }
}